using System;

namespace QUAN_LY_NGAN_HANG_CAU_HOI_TRAC_NGHIEM
{
    public class ThemGiaoVienPresenter
    {
        private IThemGiaoVien view;
        public LinhVucBUS[] LayTatCaLinhVuc()
        {
            return LinhVucBUS.LayTatCaLinhVuc();
        }

        public void Init(IThemGiaoVien v)
        {
            view = v;
        }
        public void ThemGiaoVien()
        {
            throw new System.Exception("Not implemented");
        }

        public void ListLinhVuc()
        {
            throw new System.Exception("Not implemented");
        }

        public void LayTatCaGiaoVien()
        {
            throw new System.Exception("Not implemented");
        }

        public QuyenBUS[] LayDanhSachQuyen()
        {
            return QuyenBUS.LayTatCaQuyen();
        }

        public Guid ThemGiaoVien(string tenGV, string hoGV, string cmnd, string dc, string dt, string ns, bool phai, Guid quyen, string usr, string pass)
        {
            GiaoVienDAL gv = new GiaoVienDAL();
            TaiKhoanDAL tk = new TaiKhoanDAL();
            gv.TenGiaoVien = tenGV;
            gv.HoGiaoVien = hoGV;
            gv.CMND = cmnd;
            gv.DiaChi = dc;
            gv.DienThoai = dt;
            DateTime ngaysinh;
            if (DateTime.TryParse(ns, out ngaysinh) == true)
                gv.NgaySinh = ngaysinh;
            gv.Phai = phai;
            tk.Quyen = quyen;
            tk.Username = usr;
            tk.Password = pass;
            return GiaoVienBUS.InsertThongTinGiaoVien(gv, tk);
        }
        
    }
}